Skip to content

feat: add client idle timeout [MCP-57] #383

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 21, 2025
Merged

feat: add client idle timeout [MCP-57] #383

merged 4 commits into from
Jul 21, 2025

Conversation

fmenezes
Copy link
Collaborator

@fmenezes fmenezes commented Jul 18, 2025

Proposed changes

add client idle timeout [MCP-57]

Checklist

@fmenezes fmenezes marked this pull request as ready for review July 18, 2025 17:59
@fmenezes fmenezes requested a review from a team as a code owner July 18, 2025 17:59
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import logger, { LogId, McpLogger } from "./logger.js";

class TimeoutManager {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can we add unit tests for this?


export class SessionStore {
private sessions: { [sessionId: string]: StreamableHTTPServerTransport } = {};
private sessions: {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[q] didn't check our telemetry PR but should we consider adding some http metrics? we could open a ticket for this, just checking about what you think. example: number of active sessions, timed out sessions

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does that add value? number of active sessions changes over time not sure how we would track it, we can add a time out session but bear in mind all of our telemetry is session based not server based, as it it lives inside of the MCP server not outside (http server).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fair point - we can always check w/ analytics first hence the idea of a ticket

import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import logger, { LogId, McpLogger } from "./logger.js";

class TimeoutManager {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[q] I know is tiny but should we move this into it's own separate file?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't because this is not reused and it is private to the file, no strong opinion, can be moved

import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import logger, { LogId, McpLogger } from "./logger.js";

class TimeoutManager {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can we add JS docs to the class and some of the methods below?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

almost none of our code has JS docs, we should add it across the board or not add any I think

Copy link
Collaborator

@blva blva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks for the changes!

@fmenezes fmenezes merged commit 1297ed9 into MCP-42 Jul 21, 2025
8 checks passed
@fmenezes fmenezes deleted the MCP-57 branch July 21, 2025 10:58
@fmenezes fmenezes mentioned this pull request Jul 21, 2025
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants